# 导包
import requests,app
# 创建封装的类
class EmployeeApi:

    def __init__(self):
        self.emp_url = app.BASE_URL + "/api/sys/user"

    # 封装员工列表接口
    def get_emp_list(self, headers):
        return requests.get(url=self.emp_url, params="page=1&size=10",
                     headers=headers)

    # 封装添加员工接口
    def add_emp(self, headers, jsonData):
        return requests.post(url=self.emp_url,
                      headers=headers,
                      json=jsonData)

    # 封装查询员工
    def get_emp(self, headers, emp_id):
        return requests.get(url=self.emp_url + "/" + emp_id,
                     headers=headers)

    # 封装修改员工
    def update_emp(self, headers, emp_id , jsonData):
        return requests.put(url=self.emp_url + "/" + emp_id,
                        headers=headers,
                        json=jsonData)

    # 封装删除员工
    def delete_emp(self, headers, emp_id):
        return requests.delete(url=self.emp_url + "/" + emp_id,
                               headers=headers)
